using System;
using System.Collections.Generic;
using System.Text;

namespace SharedCloud
{
    public class RefCollection
    {
        protected Dictionary<string,Dictionary<string,RefTransform>> inner;

        public RefCollection()
        {
            inner = new Dictionary<string,Dictionary<string,RefTransform>>();
        }
        public IEnumerable<string> Types
        {
            get { return inner.Keys; }
        }
        public IEnumerable<string> Properties(string type)
        {
            if (inner.ContainsKey(type))
                return inner[type].Keys;
            else
                return new List<string>();
        }

        public RefTransform this[string type,string property]
        {
            get
            {
                if (inner.ContainsKey(type))
                    if (inner[type].ContainsKey(property))
                        return inner[type][property];
                return null;
            }
            set
            {
                if (!inner.ContainsKey(type))
                    inner.Add(type, new Dictionary<string, RefTransform>());
                if (!inner[type].ContainsKey(property))
                    inner[type].Add(property, value);
                else
                    inner[type][property] = value;
            }
        }
    }
}
